Automatic electronic cropping of digital images can be used to enhance the appearance of photographs. This is frequently beneficial for consumer photographs where users typically pay little attention to image composition. Cropping can advantageously remove distractions and undesirable areas from edges of images. Automatic cropping can be constrained to generate crops of a particular aspect ratio. An example is a wide panorama which can frequently benefit from having excess areas of sky or foreground removed resulting in a wide aspect ratio.